por Francisko de Moraes Rezende, francisko.rezende@gmail.com, 2020-03-26
# carregando os pacotes ---------------------------------------------------
lista_de_pacotes <- c("tidyverse",
"readxl",
"here",
"lme4",
"janitor",
"ggbeeswarm",
"broom",
"tufte",
"ggthemes",
"ggpol")
pacotes_novos <-
lista_de_pacotes[!(lista_de_pacotes %in% installed.packages()[, "Package"])]
if (length(pacotes_novos))
install.packages(pacotes_novos)
library(tidyverse)
library(readxl)
library(here)
library(lme4)
library(janitor)
library(ggbeeswarm)
library(broom)
library(ggthemes)
library(ggpol)
ui_m1 <- lm(ui ~ sp * face, data = ui)
anova(ui_m1)
ui_m2 <- update(ui_m1, . ~ . -sp:face)
anova(ui_m2) %>%
rename(`P value` = `Pr(>F)`)
anova(ui_m2) %>%
rename(`P value` = `Pr(>F)`) %>%
knitr::kable(digits = 3)
| Df | Sum Sq | Mean Sq | F value | P value | |
|---|---|---|---|---|---|
| sp | 1 | 1.082 | 1.082 | 238.52 | 0.000 |
| face | 1 | 0.000 | 0.000 | 0.07 | 0.798 |
| Residuals | 9 | 0.041 | 0.005 | NA | NA |
Os dois gráficos abaixo tem as mesmas informções, escolha o que mais lhe agradar.
ui %>%
ggplot(aes(x = sp, y = ui)) +
geom_boxplot() +
geom_quasirandom(groupOnX = T,
alpha = .5) +
theme_classic() +
theme(axis.line.x = element_blank(),
text = element_text(size = 12))
ui %>%
ggplot(aes(x = sp, y = ui)) +
geom_boxjitter(jitter.height = 0) +
theme_classic() +
theme(axis.line.x = element_blank(),
text = element_text(size = 12))
angle_m1 <- lm(angle ~ sp*face, data = angle)
anova(angle_m1)
angle_m2 <- update(angle_m1, . ~ . - sp:face)
anova(angle_m1, angle_m2)
anova(angle_m2)
| Df | Sum Sq | Mean Sq | F value | P value | |
|---|---|---|---|---|---|
| sp | 1 | 11803.277 | 11803.28 | 586.646 | 0.000 |
| face | 1 | 17.280 | 17.28 | 0.859 | 0.378 |
| Residuals | 9 | 181.079 | 20.12 | NA | NA |
Os dois gráficos abaixo tem as mesmas informções, escolha o que mais lhe agradar.
angle %>%
ggplot(aes(x = sp, y = angle)) +
geom_boxplot() +
geom_quasirandom(groupOnX = T,
alpha = .5) +
theme_classic() +
theme(axis.line.x = element_blank(),
text = element_text(size = 12))
angle %>%
ggplot(aes(x = sp, y = angle)) +
geom_boxjitter(jitter.height = 0) +
theme_classic() +
theme(axis.line.x = element_blank(),
text = element_text(size = 12))